class UsersController < ApplicationController
  def index
  	@users = User.all
  	@title = "Display all users"
  end

  def new
  	@user = User.new
  	@title = "Add new users"
  end

  def create

    @user = User.new(user_params)
    if @user.save
      redirect_to users_path
    else
      render action: "new"
    end
  end

  private
  def user_params
    params.require(:user).permit(:name, :email)
  end
end
